require 'watir'
include Watir
require 'test/unit'
class TC_blogsFrontEnd < Test::Unit::TestCase
  	def test_56_CreateBlogGroupWithoutName_Blogs
      $ie.goto($UniVar)

#Create Blog
    $ie.goto($UniVar + '/controlpanel/BlogAdmin/sectionedit.aspx')
    $ie.wait()    
    $ie.text_field(:index, 1).set('watir blog')
    $ie.text_field(:index, 2).set('watirblog')
    $ie.text_field(:index, 3).set($ADMIN)
    $ie.link(:text, 'Save').click    

#Test Specifics
  $ie.goto($UniVar + '/controlpanel/blogAdmin/Groups.aspx')
	$ie.link(:text, 'Add New Group').click
  $ie.frame(:index, 1).text_field(:id, /GroupDesc$/).value = 'Without Group Name'
  $ie.frame(:index, 1).link(:id, /SaveButton$/).click
  
  assert(!$ie.contains_text('Without Group Name'))
      $ie.frame(:index, 1).text_field(:id, /GroupName$/).value = 'Add A Name'
      $ie.frame(:index, 1).link(:id, /SaveButton$/).click      

  $ie.div(:index, 63).click
  $ie.link(:text, 'Delete').click_no_wait
      hwnd = $ie.enabled_popup(5)
      if(hwnd)
        w = WinClicker.new
        w.clickWindowsButton_hwnd(hwnd, "OK")
      end  
  
  #Delete Blog      
  $ie.goto($UniVar + '/controlpanel/BlogAdmin/Blogs.aspx')
  $ie.wait()
  $ie.link(:text, 'Delete').click_no_wait
  hwnd = $ie.enabled_popup(20)
    if(hwnd)
      w = WinClicker.new
      w.clickWindowsButton_hwnd(hwnd, "OK")
    end
	end
end